﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace FXnaEngine.Components
{

    /// <summary>
    /// 用于渲染天空盒
    /// </summary>
    public class FSkyboxComponent:FRendererComponent
    {

        public FSkyboxComponent(FEntity parent)
            : base(parent)
        {


 

        }

        public override bool ExecuteMessage(IMessage message)
        {

            return true;




        }



        /// <summary>
        /// Default sky color
        /// </summary>
        static readonly Color DefaultSkyColor = new Color(232, 232, 232);

        /// <summary>
        /// The Cube Map texture for the sky!
        /// </summary>
        private TextureCube skyCubeMapTexture = null;

        /// <summary>
        /// Sky cube map texture
        /// </summary>
        /// <returns>Texture cube</returns>
        public TextureCube SkyCubeMapTexture
        {
            get
            {
                return skyCubeMapTexture;
            }
        }


        private Model cube;





        protected override void RenderCore(Graphics.FGraphicsSystem graphics)
        {
            
            base.RenderCore(graphics);


            FSkyCubeSE.DefaultSkyCubeSE.RenderSky();

            //渲染前需要关闭深度缓存，渲染后需要打开

            //FEngineState.Device.DepthStencilState = DepthStencilState.None;

            // FEngineState.Device.RasterizerState.CullMode = CullMode.None;

           














            //FEngineState.Device.DepthStencilState = DepthStencilState.Default;



        }




    }
}
